package com.qidian.mes.device.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.device.service.DeviceService;
import com.qidian.mes.pojo.Device;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 刘泽磊
 * @Company 起点编程
 * @Description
 * @Time 2024/10/16 19:01
 */
@RestController
@RequestMapping("/device")
@CrossOrigin
public class DeviceController {
    @Autowired
    private DeviceService deviceService;
    @GetMapping("/list")
    public MESResult list(Device device) {
        return deviceService.select(device);
    }
    @PostMapping("/insert")
    public MESResult insert(@RequestBody Device device){
        return deviceService.insert(device);
    }
    @PutMapping("/update")
    public MESResult update(@RequestBody Device device){
        return deviceService.update(device);
    }
    @GetMapping("/selectById")
    public MESResult selectById(Long deviceId){
        return deviceService.selectById(deviceId);
    }
    @DeleteMapping("/delete")
    public MESResult delete(Long deviceId){
        return deviceService.delete(deviceId);
    }
}
